/************************************************************************/
/*Copyright (c) James Zhao 2007,2008
/*This file is part of AdminOverlay.
/*AdminOverlay is free software: you can redistribute it and/or modify
/*it under the terms of the GNU General Public License as published by
/*the Free Software Foundation, either version 3 of the License, or
/*(at your option) any later version.
/*
/*AdminOverlay is distributed in the hope that it will be useful,
/*but WITHOUT ANY WARRANTY; without even the implied warranty of
/*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
/*GNU General Public License for more details.
/*
/*You should have received a copy of the GNU General Public License
/*along with AdminOverlay.  If not, see <http://www.gnu.org/licenses/>.                                                                     */
/*************************************************************************/
#include "ServerSession.h"
#include "XMLRPCServerSession.h"
ServerSession::ServerSession( LPCTSTR pIP, int pPort, LPCTSTR pPassword ) :
	ip(pIP), port(pPort), password(pPassword)
{
	isConnected = false;

}
ServerSession::~ServerSession(void)
{
}

void ServerSession::IsConnected( bool val )
{
	if(isConnected != val)
	{
		isConnected = val;
	}
}

bool ServerSession::IsConnected() const
{
	return isConnected;
}

LPCTSTR ServerSession::IP() const
{
	return ip;
}

void ServerSession::IP( LPCTSTR val )
{
	ip = val;
}

void ServerSession::Password( LPCTSTR val )
{
	password = val;
}

LPCTSTR ServerSession::Password() const
{
	return password;
}

int ServerSession::Port() const
{
	return port;
}

void ServerSession::Port( int val )
{
	port = val;
}

ServerSession* ServerSession::createServerSession( SessionType sessionType, LPCTSTR ip, int port, LPCTSTR password )
{
	switch(sessionType)
	{
	case SessionType_XMLRPC:
		return new XMLRPCServerSession(ip, port, password);
		break;
	default:
		return NULL;
	}
}